<?php 
	include_once("./com.php");
//订单搜索关联了两表
	if(isset($_POST['sub'])){
		$order_sn=$_POST['order_sn'];
			$sql="select ord.*,ad.t_name,ad.t_add from ts_order ord,ts_address ad where ord.addr_id=ad.addr_id and order_sn='$order_sn'";
		$ser=mysql_query($sql);
		while ($list=mysql_fetch_assoc($ser)) {
		    $fgh[]=$list;
		}
	}
	
 ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>商品管理</title>
<base target="_self">
<link rel="stylesheet" type="text/css" href="skin/css/base.css" />
<link rel="stylesheet" type="text/css" href="skin/css/main.css" />
</head>
<style type="text/css">
.input-text{
  width: 450px;
  height: 34px;
  font-size: 14px;
  line-height: 1.42857;
  color: rgb(85, 85, 85);
  background-color: rgb(255, 255, 255);
  background-image: none;
  box-shadow: rgba(0, 0, 0, 0.075) 0px 1px 1px inset;
  padding: 6px 12px;
  border-width: 1px;
  border-style: solid;
  border-color: rgb(204, 204, 204);
  border-image: initial;
  border-radius: 4px;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.btn-primary{
    background-color: #3c8dbc;
    border-color: #367fa9;
}
.btn {
    display: inline-block;
    padding: 6px 32px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #fff;
}
</style>
<body leftmargin="8" topmargin='8'>
<table width="98%" align="center" border="0" cellpadding="3" cellspacing="1" bgcolor="#CBD8AC" style="margin-bottom:8px;margin-top:8px;">
  <tr>
    <td background="skin/images/frame/wbg.gif" bgcolor="#EEF4EA" class='title' colspan="2"><span><img src='skin/images/frame/arr3.gif' style='margin-right:10px;'>订单列表</span></td>
  </tr>
  <tr bgcolor="#FFFFFF">
       <td colspan="2">
            <table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#CFCFCF" align="center" style="margin-top:8px">
            	<form action="" method="post">
            <tr align="center" bgcolor="#FBFCE2" height="25">
            	<td>
            	<input type = "text" class = "input-text" name = "order_sn"/>
            	<input type = "submit"  name="sub" value=" 搜索 " class = "btn btn-primary" style = "margin-bottom:5px;">
               </td>
            </tr>
            <!-- 搜索后的遍历 -->
		<?php if(isset($_POST['order_sn'])) { ?>
             <table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#CFCFCF" align="center" style="margin-top:8px"> 
             <tr align="center" bgcolor="#FBFCE2" height="25">
                <th width="3%">编号</th>
                <th width="10%">收货地址</th>
                <th width="10%">收货人</th>
                <th width="10%">总价</th>
                <th width="10%">支付状态</th>
                <th width="10%">发货状态</th>
                <th width="10%">订单时间</th>
                <th width="10%">订单号</th>
                <th width="10%">操作</th>
            </tr> 
            <?php foreach ($fgh as $value){ ?>            	
			<tr align='center' bgcolor="#FFFFFF" height="26" align="center" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';">
				 <td><?= $value['order_id'] ?></td>
                <td><?= $value['t_add'] ?></td>
                <td><?= $value['t_name'] ?></td>
                <td><?= $value['subtotal'] ?></td>
                 <td>
                 <?php if($value['pay_status']==0) {?>
                 		   未支付
                 <?php	}elseif($value['pay_status']==1){ ?>
                 		   已支付                             
                 <?php } ?>               
               </td>
               <td>                
               <?php if($value['delivery_status']==0){ ?>
						    <a href="order_edit.php?order_id=<?= $value['order_id'] ?>&type=1">是否发货？</a>
				       <?php }elseif($value['delivery_status']==1){ ?>
                 		 发货
              <?php }elseif($value['delivery_status']==2) { ?>
                     已收货 
              <?php } ?>
              
               </td>
                <td><?= $value['order_time'] ?></td>
                <td><?= $value['order_sn'] ?></td>		 	
		 	<td width="10%">
                    <img src='./skin/images/frame/trun.gif' title="编辑" alt="编辑" onClick="QuickEdit(179, event, this);" style='cursor:pointer' border='0' width='16' height='16' />

                    <img src='./skin/images/frame/gtk-del.png' title="删除" alt="删除" onClick="editArc(179);" style='cursor:pointer' border='0' width='16' height='16' />        
                </td>
                 </tr>
		 <?php } ?>
	<?php }?>
       	</form>
       	</table>
       </table>
    </td>
  </tr>
  </tr>
</table>
</body>
</html>